<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title> </title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="__ROOT__/Public/Admin/shortcut icon" href="favicon.ico"> 
    <link href="__ROOT__/Public/Admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/animate.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" href="__ROOT__/Public/Admin/css/index.css" />
</head>

<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
    <!-- 全局js -->
    <script src="__ROOT__/Public/Admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="__ROOT__/Public/Admin/js/plugins/layer/layer.min.js"></script>
</body>

<style>
.layui-tree li h2 {
    line-height: 36px;
    border-left: 5px solid #009E94;
    margin: 0px 0 5px;
    padding: 0 10px;
    background-color: #f2f2f2;
}
.layui-tree a cite {
    padding-left: 15px;
    font-size: 14px;
    font-style: normal;
}
.layui-tree a {
    color: #333;
}
.layui-tree a:hover {
    color: #777;
}
.layui-tree {
    line-height: 30px;
}
h1, h2, h3 {
    font-size: 14px;
    font-weight: 400;
}
ul li{
list-style-type:none;
}
li {
    display: list-item;
    text-align: -webkit-match-parent;
}
ul, menu, dir {
    display: block;
    list-style-type: disc;
    -webkit-margin-before: 0em;
    -webkit-margin-after: 0em;
    -webkit-margin-start: 0px;
    -webkit-margin-end: 0px;
    -webkit-padding-start: 0px;
}
.J_menuItem {
    border-bottom: 0px solid #333;
}
#page-wrapper {
    padding: 0 15px;
    position: inherit;
    margin: 0 0 0 15%;
}
#content-main {
    height: calc(100% - 20px);
    overflow: hidden;
}
.sidebar-collapse{
    overflow-y: auto;
}
.borderList{
	border-bottom: 1px dashed #333;
	margin: 10px;
}
</style>
	<div id="wrapper" style="margin:0px">
		<nav class="navbar-static-side" style="background: #ffffff; width: 15%;border-right: 1px solid #eee;">
			<div class="sidebar-collapse" style="width: auto; height: 100%;">
				<ul class="layui-tree">
					<!-- li><h2>流程办理</h2></li -->
					<!-- li ><h2>表单列表</h2></li -->
					<!-- li class="Prhandle"></li -->
					<p style="height:1px;"> </p>
					<li><a class="J_menuItem handleUrl"><cite></cite></a></li>
					<li><a class="J_menuItem enclosureUrl"><cite></cite></a></li>
					<li class="borderList"></li>
					<li class="formList"></li>
				</ul>
			</div>
		</nav>
		<div id="page-wrapper" class="gray-bg dashbard-1">
			<div class="row J_mainContent" id="content-main">
                <iframe id="J_iframe" width="100%" height="100%" src="index.html" frameborder="0" data-id="" seamless=""></iframe>
            </div>
		</div>
	</di>
</html>
<script type="text/javascript" src="__ROOT__/Public/Admin/js/jquery.min.js"></script>
<script>
	layer.config({extend: 'extend/layer.ext.js'}) 
	var PResult;
	var taskID = {$id};
	var PRID;
	var BALID = 0;
	var handleUrl = "{:U('Admin/Process/processHandle',array('PRID'=>''))}";
	var enclosureUrl = "{:U('Admin/Process/processEnclosure',array('PRID'=>''))}";
	//完成左 边菜单 初始化
	$.post("{:U('Admin/TaskProcess/getFormListByTid')}",{"TID":taskID},function(result){ 
		var html = "";
		PRID = result.PRID;
		handleUrl += PRID+"&TID="+taskID+"&BPName="+result.BPName;
		enclosureUrl += PRID+"&TID="+taskID+"&BPName="+result.BPName;
		$(".handleUrl").attr("href",handleUrl);
		$(".enclosureUrl").attr("href",enclosureUrl);
		if(result.BPName == null){
			$(".handleUrl > cite").text("查看流程");
			$(".enclosureUrl > cite").text("查看附件");
		}else{
			$(".handleUrl > cite").text("流程办理");
			$(".enclosureUrl > cite").text("附件操作");
			//$(".handleUrl > cite").text(result.BPName + "");
		}
		
		for(var v in result.list){ //表单列表
			html += "<li><a class=\"J_menuItem\" href='"+result.list[v].url+"'><cite>"+result.list[v].CName+"</cite></a></li>";
		}
		
		
		$(".formList").after(html);
		J_iframe
		$(".J_menuItem").on('click',function(){
		    var url = $(this).attr('href');
		    $("#J_iframe").attr('src',url);
		    return false;
		});		    
	});
	
	//返回前面流程弹窗
	function ReturnPprocessView(){
		$htmla = "";
		$.post("{:U('Admin/TaskProcess/getFrontProcess')}",{"TID":taskID,"PRID":PRID},function(result){
			if(result.status == 0){
				layer.msg(result.info);
				return;
			}
			for(var k in result){
				$htmla += "<a href=\"#\" class=\"list-group-item\" onclick='ReturnPprocess("+result[k].ID+");'>"+result[k].Name+"</a>";
			}
			layer.open({
			  type: 1,
			  title: "流程列表",
			  skin: 'layui-layer-rim', //加上边框
			  area: ['22%', '60%'], //宽高
			  content: $htmla
			});
		});		
	}
	
	//返回前面流程
	function ReturnPprocess(RBPID){
		layer.prompt({
			formType: 2,
			value: '',
			title: '返回原因',
			area: ['27%', '39%'] //自定义文本域宽高
		}, function(value, index, elem){
				$.post("{:U('Admin/TaskProcess/ReturnPprocess')}",{"LBPID":PRID,"RBPID":RBPID,"ReturnReaso":value,"PResult":PResult},function(result){
					if(result.status == 1){
						layer.msg(result.info);
						window.setInterval(closeLayerP, 800); 
					}
				});
		});
	}
	
	function closeLayerP(){
		var index = parent.layer.getFrameIndex(window.name);  
		parent.layer.close(index); 
	}
	
	//任务提前办结申请
	function taskApplyEnd(){
		layer.prompt({
			formType: 2,
			value: '',
			title: '申请原因',
			area: ['27%', '39%'] //自定义文本域宽高
		}, function(value, index, elem){
				$.post("{:U('Admin/TaskProcess/TaskApplyEnd')}",{"PRID":PRID,"Reason":value,"PResult":PResult},function(result){
					if(result.status == 1){
						layer.msg(result.info);
						window.setInterval(closeLayerP, 800); 
					}
				});
		});
	}
	
	//上传附件弹窗
	function layeropenUPFile(TID){
	    layer.open({
			type: 2,
			title: '附件上传',
			skin: 'layui-layer-rim', 
			area: ['95%', '95%'], 
			content: "{:U('Admin/process/processUPFile')}&TID="+TID+"&BALID="+BALID+"&PRID="+PRID
		});
	}
	
	//更新附件列表
	function updateFJlist(BALID){
		$("#J_iframe")[0].contentWindow.showFJlist(BALID);
	}

		
	
</script>